var path = "http://127.0.0.1:8081/recruit/"
// $(function(){
// 	$.ajax({
// 	url: path + "user/checkIsLogin",
// 	type: "POST",
// 	data: {},
// 	dataType: "json",
// 	crossDomain: true,
// 	xhrFields: {
// 		withCredentials: true
// 	},
// 	async: false,
// }).done(function(data) {
// 	console.log(data.failed)
// 	if(data.failed != undefined){

// 		window.location.href = "login.html"
// 	}
// })
// })

function checkLogin() {
	var isLogin = false;
	$.ajax({
		url: path + "user/checkIsLogin",
		type: "POST",
		data: {},
		dataType: "json",
		crossDomain: true,
		xhrFields: {
			withCredentials: true
		},
		async: false,
	}).done(function(data) {
		console.log(data.failed)
		if (data.failed != undefined) {
			isLogin = true;
		}
	})
	return isLogin;
}

function toLogin(parma) {
	window.location.href = "login.html" + parma
}

function checkUserType() {
	var f
	$.ajax({
		url: path + "user/selectUserBaseInfo",
		type: "POST",
		data: {},
		dataType: "json",
		crossDomain: true,
		xhrFields: {
			withCredentials: true
		},
		async: false,
	}).done(function(data) {
		
		if (data.redirect != undefined) {
			f= 1;
		}else{
			f= 0;
		}
		
		if(f == 1){
			$("#my").css("display","none")
			$("#myJianli").css("display","none")
			
		}else{
			$("#myhome").css("display","none")
			$("#fabuziwei").css("display","none")
		}
		
		
	})
	return f
	
}

function outLogin(){
	$.ajax({
		url: path + "user/outLogin",
		type: "POST",
		data: {},
		dataType: "json",
		crossDomain: true,
		xhrFields: {
			withCredentials: true
		},
		async: false
	}).done(function(data) {
		
		window.location.href="index.html"
		
		
	})
}
